<?php

class Api_ErrorController extends Zend_Rest_Controller
{

	/**
	 * Disable the views
	 */
	public function  init()
	{
		$this->_helper->viewRenderer->setNoRender(true);
	}

	/**
	 * Send error back to client
	 */
	public function errorAction()
	{
		$errors = $this->_getParam('error_handler');

		switch ($errors->type) {
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
			case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
				// 404 error -- controller or action not found
				$this->getResponse()->appendBody('URL Not Found');
				$this->getResponse()->setHttpResponseCode(404);
				break;
			default:
				// application error
				$this->getResponse()->appendBody('Interal Server Error');
				$this->getResponse()->setHttpResponseCode(500);
				break;
		}
	}

	public function loginAction() {
		$this->getresponse()->appendBody('Unauthorized');
		$this->getResponse()->setHttpResponseCode(401);

	}

	public function indexAction() {}
	public function getAction() {}
	public function postAction() {}
	public function putAction() {}
	public function deleteAction() {}
	public function headAction() {}
}

